<form class="layui-form" action="">
         <div class="layui-form-item">
                <label class="layui-form-label">图片名称</label>
                <div class="layui-input-block">
                    <input type="text" name="scimgname" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
                </div>
           </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图片路径</label>
        <div class="layui-input-block">
            <input type="text" style="width: 200px;" name="scimgurl" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
        <button type="button" class="layui-btn" id="test1">
            <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">截图时间</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="createtime" id="entrytime">
        </div>
    </div>
         <div class="layui-form-item">
                <label class="layui-form-label">截图类型</label>
             <div class="layui-input-block">
                 <input type="text" name="scimgtype" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
             </div>
           </div>
         <div class="layui-form-item">
                <label class="layui-form-label">监控点ID</label>
             <div class="layui-input-block">
                 <input type="text" name="mptid" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
             </div>
           </div>
         <div class="layui-form-item">
                <label class="layui-form-label">值班人员ID</label>
             <div class="layui-input-block">
                 <input type="text" name="crewid" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
             </div>
           </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(["jquery","form"],function () {
        var $=layui.jquery
        ,form=layui.form;
        form.on('submit(demo1)', function(data){//点击提交按钮
           $.ajax({
               url:"/shotcutimage/addShotcutimage",
               data:data.field,
               dataType:"json",
               type:"post",
               success:function (msg) {
                   if (msg.code==0){
                        tableIns.reload({
                            page:{
                                curr:1
                            }
                        });
                        layer.msg(msg.msg);//提示后台传过来的信息
                        layer.close(openIndex);//关闭当前弹出的窗体
                   }else{
                       layer.msg(msg.msg);//提示后台传过来的信息
                   }
               }
           });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });

    layui.use(['upload','jquery'], function(){
        var upload = layui.upload,
            $=layui.jquery;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: '../file/upload',//上传接口
            dataType:"json",
            type:"post"
            ,done: function(msg){
                if(msg.code==1){
                    layer.msg(msg.msg);//提示后台传过来的信息
                    $("#url").val(msg.data);
                }else {
                    layer.msg(msg.msg);//提示后台过来的信息
                }
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>